package indi.madoka.weeb.bean.update.message;

import indi.madoka.weeb.annotations.Keyword;
import indi.madoka.weeb.bean.BaseMatchingInfo;
import indi.madoka.weeb.enums.MatchType;
import indi.madoka.weeb.utils.RegUtil;

/**
 * @author Arcueid
 */
public class MessageMatchingInfo extends BaseMatchingInfo {
    private final Keyword annotation;

    public MessageMatchingInfo(Object clazz, String plugin, Keyword annotation) {
        super(clazz,plugin);
        this.annotation = annotation;
    }

    public boolean matches(String keyword){
        return RegUtil.regMatchByMatchType(annotation.value(),keyword,annotation.matchType());
    }

    public MatchType getMatchType() {
        return annotation.matchType();
    }

    public String getPlugin() {
        return plugin;
    }

    public Keyword getAnnotation() {
        return annotation;
    }

    public String getKeyword(){
        return annotation.value();
    }

    public String getDescription(){
        return annotation.description();
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }
}
